package sam.learn.biz.user.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sam.learn.biz.user.repo.entity.UserInfo;
import sam.learn.biz.user.service.UserInfoService;

@RestController
@RequestMapping("/user")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/queryByUsername")
    public UserInfo queryByUsername(String username) {
        return userInfoService.queryUserInfoBy(username);
    }

    @PostMapping("/add")
    public UserInfo addUserInfo(String username, String password, String nickName, String regionCode) {
        return userInfoService.addUserInfo(username, password, nickName, regionCode);
    }

}
